package com.af.community.smart.business

import android.os.Bundle
import android.view.View
import com.af.community.smart.base.BaseActivity
import com.af.community.smart.base.loadLinear
import com.af.community.smart.base.refresh
import com.af.community.smart.model.CommonData
import kotlinx.android.synthetic.main.layout_list.*
import net.idik.lib.slimadapter.SlimAdapter
import org.jetbrains.anko.include
import org.jetbrains.anko.startActivity

class InitialActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        include<View>(R.layout.layout_list)
        initTitle(title = "业务事项初审")

        mAdapter.updateData(mList.apply {
            add(CommonData())
            add(CommonData())
            add(CommonData())
            add(CommonData())
            add(CommonData())
        })
    }

    override fun initTitle(title: String, name: String) {
        super.initTitle(title, name)
        swipe_refresh.refresh {  }
        recycle_list.loadLinear(baseContext, swipe_refresh) {

        }

        mAdapter = SlimAdapter.create()
            .register<CommonData>(R.layout.item_speed_list) { _, injector ->
                injector.clicked(R.id.item_speed) {
                    startActivity<SpeedDetailActivity>("title" to "审核")
                }
            }
            .attachTo(recycle_list)
    }

}
